Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a bug that prevented #pretty_print from displaying records unsaved in collection association. #48653

Merged
merged 1 commit into from Jul 5, 2023

Conversation

alpaca-tc
Copy link
Contributor

@alpaca-tc alpaca-tc commented Jul 5, 2023

Motivation / Background

The change in PR #43302 introduced a bug where unsaved records are not displayed in pretty_print. The following code will not show unsaved records until this PR is merged.

post = Post.create!
post.comments.build

pp(post.comments) #=> expected "[#<Comment:0x000000014c0b48a0 ...>]", got "[]"

Detail

Fixed to call #load_target before display as well as #inspect.

Additional information

Checklist

Before submitting the PR make sure the following are checked:

  • This Pull Request is related to one change. Changes that are unrelated should be opened in separate PRs.
  • Commit message has a detailed description of what changed and why. If this PR fixes a related issue include it in the commit message. Ex: [Fix #issue-number]
  • Tests are added or updated if you fix a bug or add a feature.
  • CHANGELOG files are updated for the changed libraries if there is a behavior change or additional feature. Minor bug fixes and documentation changes should not be included.

…d in collection association.

The change in PR rails#43302 introduced a bug where unsaved records are not displayed in pretty_print.
The following code will not show unsaved records until this PR is merged.

```ruby
post = Post.create!
post.comments.build

pp(post.comments) #=> expected "[#<Post:0x000000014c0b48a0 ...>]", got "[]"
```

Fixed to call `#load_target` before display as well as `#inspect`.
@alpaca-tc alpaca-tc force-pushed the fix-association-pretty-print branch from ad2ad28 to 4c245bf Compare July 5, 2023 03:09
@kamipo kamipo merged commit c9d7c10 into rails:main Jul 5, 2023
8 of 9 checks passed
@alpaca-tc alpaca-tc deleted the fix-association-pretty-print branch July 5, 2023 05:35
kamipo added a commit that referenced this pull request Sep 4, 2023
Fix a bug that prevented #pretty_print from displaying records unsaved in collection association.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants